package com.mc.common.guava;

import com.google.common.base.Strings;
import org.junit.Test;

import static org.hamcrest.core.IsEqual.equalTo;
import static org.hamcrest.core.IsNull.nullValue;
import static org.junit.Assert.assertThat;

/**
 * @author cc
 * @ClassName StringsTest.java
 * @Description Strings工具测试
 * @createTime 2019年07月23日 14:22:00
 */
public class StringsTest {

    @Test
    public void testStringsMethod() {
        assertThat(Strings.emptyToNull(""), nullValue());
        assertThat(Strings.nullToEmpty(null), equalTo(""));
        assertThat(Strings.commonPrefix("hello","hex"), equalTo("he"));
        assertThat(Strings.commonSuffix("hello","scalo"), equalTo("lo"));
    }


}
